import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { useI18n } from '/@/hooks/web/useI18n';

import { Getallpersondto } from '/@/api/demo/system';

const { t } = useI18n();

export const columns: BasicColumn[] = [
  {
    title: t('routes.table.accountManagement.id'),
    dataIndex: 'id',
    fixed: 'left',
    width: 120,
  },
  {
    title: t('routes.table.accountManagement.name'),
    dataIndex: 'name',
    width: 120,
  },
  {
    title: t('routes.table.accountManagement.usedHost'),
    dataIndex: 'usedHost',
    width: 120,
  },
  {
    title: t('routes.table.accountManagement.sex'),
    dataIndex: 'sex',
    width: 80,
  },
  {
    title: t('routes.table.accountManagement.sign'),
    dataIndex: 'sign',
    width: 80,
    slots: { customRender: 'sign' },
  },
  {
    title: t('routes.table.accountManagement.ipAddress'),
    dataIndex: 'ipAddress',
    width: 100,
  },
  {
    title: t('routes.table.accountManagement.email'),
    dataIndex: 'email',
    width: 180,
  },
  {
    title: t('routes.table.accountManagement.tel'),
    dataIndex: 'tel',
    width: 150,
  },
  {
    title: t('routes.table.accountManagement.address'),
    dataIndex: 'address',
    width: 150,
  },
  {
    title: t('routes.table.accountManagement.createTime'),
    dataIndex: 'createTime',
    width: 150,
    slots: { customRender: 'createTime' },
  },
  {
    title: t('routes.table.accountManagement.creator'),
    dataIndex: 'creator',
    width: 150,
  },
  {
    title: t('routes.table.accountManagement.remark'),
    dataIndex: 'remark',
    width: 150,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'id',
    label: t('routes.table.accountManagement.id'),
    component: 'Input',
    colProps: { span: 8 },
  },
  {
    field: 'name',
    label: t('routes.table.accountManagement.name'),
    component: 'Input',
    colProps: { span: 8 },
  },
];

export const formSchema: FormSchema[] = [
  {
    field: 'id',
    label: t('routes.table.departmentManagement.departmentCode'),
    component: 'Input',
    required: true,
    defaultValue: '',
  },
  {
    field: 'name',
    label: t('routes.table.departmentManagement.departmentName'),
    component: 'Input',
    required: true,
    defaultValue: '',
  },
  {
    field: 'manager',
    label: t('routes.table.departmentManagement.departmentPrincipal'),
    component: 'ApiSelect',
    defaultValue: '',
    componentProps: {
      api: Getallpersondto,
      labelField: 'name',
      valueField: 'id',
      getPopupContainer: () => document.body,
    },
  },
  {
    field: 'viceManager',
    label: t('routes.table.departmentManagement.departmentVicePrincipal'),
    component: 'ApiSelect',
    defaultValue: '',
    componentProps: {
      api: Getallpersondto,
      labelField: 'name',
      valueField: 'id',
      getPopupContainer: () => document.body,
    },
  },
  {
    label: t('routes.table.departmentManagement.remark'),
    field: 'remark',
    component: 'InputTextArea',
    defaultValue: '',
  },
];
